package com.nbsaas.boot.common.data.entity;

import com.nbsaas.boot.code.annotation.*;
import com.nbsaas.boot.jpa.data.entity.LongEntity;
import com.nbsaas.boot.jpa.data.entity.User;
import lombok.Data;
import org.hibernate.annotations.Comment;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import java.util.Date;


@ComposeView
@org.hibernate.annotations.Table(appliesTo = "sys_common_operation_log", comment = "操作日志")
@Data
@FormAnnotation(title = "操作日志")
@Entity
@Table(name = "sys_common_operation_log")
public class OperationLog extends LongEntity {


    @FormField(title = "执行类", grid = true, width = "400", col = 22)
    @SearchItem(label = "执行类", name = "className")
    @Comment("执行类")
    private String className;

    @FormField(title = "执行方法", grid = true, width = "400", col = 22)
    @SearchItem(label = "执行方法", name = "methodName")
    @Comment("执行方法")
    private String methodName;

    @Comment("请求参数")
    private String params;

    @FormField(title = "ip地址", grid = true, width = "200", col = 22)
    @Comment("ip地址")
    private Long ip;


    @FormField(title = "执行人", grid = true, width = "400", col = 22)
    @FieldName
    @FieldConvert
    @ManyToOne(fetch = FetchType.LAZY)
    private User creator;


    @FormField(title = "添加时间", grid = true, width = "10000", ignore = true)
    @Comment("添加时间")
    private Date addDate;


    @Comment("最新修改时间")
    private Date lastDate;
}
